package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zrv extends zbz {
   private ArrayList a;

   zrv() {
      this.c(2189);
   }

   void a(Style var1, boolean var2, Workbook var3) {
      this.a = new ArrayList();
      int var4 = 18;
      if (var1.q() != null && var1.isModified(11)) {
         Font var5 = var1.getFont();
         if (var1.isModified(16)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(5, var5.b, var5.b(), false, var3));
         }

         if (var1.isModified(13) && var5.getName() != null) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(24, var5.getName()));
         }

         if (var1.isModified(17)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(25, (int)var5.g()));
         }

         if (var1.isModified(19)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(26, (int)zcee.d(var5.getUnderline())));
         }

         if (var1.isModified(23)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(27, (int)var5.e()));
         }

         if (var1.getFont().a() != null) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(37, (byte)zcee.b(var1.getFont().a())));
         }

         if (var1.isModified(18)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(28, var5.isItalic()));
         }

         if (var1.isModified(20)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(29, var5.isStrikeout()));
         }

         if (var1.isModified(14)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(35, (byte)var5.h()));
         }

         if (var1.isModified(12)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.b(36, var5.i()));
         }
      }

      int var8;
      if (var1.isModified(24)) {
         var8 = var1.r();
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(38, var1.getCustom()));
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(41, (int)var8));
      }

      if (var1.isModified(33) || var1.isModified(34) || var1.isModified(35)) {
         var8 = zcee.o(var1.getPattern());
         if (var1.isModified(33)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(0, (byte)((byte)var8)));
         }

         if (var1.isModified(34)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(1, var1.b, var1.b(), false, var3));
         }

         if (var1.isModified(35)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(2, var1.a, var1.a(), false, var3));
         }
      }

      if (var1.isModified(31)) {
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(15, (byte)((byte)zcee.h(var1.getHorizontalAlignment()))));
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(16, (byte)((byte)zcee.f(var1.getVerticalAlignment()))));
         var8 = var1.getRotationAngle();
         if (var8 < 0) {
            var8 = 90 - var8;
         }

         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(17, (byte)((byte)var8)));
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(18, (int)var1.getIndentLevel()));
         if (var1.getTextDirection() == 1) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(19, (byte)1));
         } else if (var1.getTextDirection() == 2) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(19, (byte)2));
         }

         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(20, var1.isTextWrapped()));
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(22, var1.getShrinkToFit()));
      }

      if (var1.isModified(1) && var1.d() != null) {
         BorderCollection var9 = var1.d();
         Border var6 = var9.getByBorderType(4);
         if (var1.isModified(4)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(6, 4, var6, var1, false, var3));
         }

         var6 = var9.getByBorderType(8);
         if (var1.isModified(5)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(7, 8, var6, var1, false, var3));
         }

         var6 = var9.getByBorderType(1);
         if (var1.isModified(2)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(8, 1, var6, var1, false, var3));
         }

         var6 = var9.getByBorderType(2);
         if (var1.isModified(3)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(9, 2, var6, var1, false, var3));
         }

         var6 = var9.getByBorderType(32);
         if (var1.isModified(10)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(13, 32, var6, var1, false, var3));
         }

         var6 = var9.getByBorderType(16);
         if (var1.isModified(9)) {
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(14, 16, var6, var1, false, var3));
         }
      }

      if (var1.isModified(36)) {
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(43, var1.isLocked()));
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)this.a(44, var1.isFormulaHidden()));
      }

      byte[] var12;
      for(Iterator var10 = this.a.iterator(); var10.hasNext(); var4 += var12.length) {
         var12 = (byte[])var10.next();
      }

      this.c = new byte[var4];
      this.a((short)var4);
      this.c[0] = -115;
      this.c[1] = 8;
      if (var2) {
         this.c[12] = (byte)(this.c[12] | 2);
      }

      this.c[12] = 3;
      byte var11 = 14;
      var8 = var11 + 2;
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.size()), 0, this.c, var8, 2);
      var8 += 2;

      byte[] var7;
      for(Iterator var13 = this.a.iterator(); var13.hasNext(); var8 += var7.length) {
         var7 = (byte[])var13.next();
         System.arraycopy(var7, 0, this.c, var8, var7.length);
      }

   }

   private byte[] a(int var1, boolean var2) {
      return this.a(var1, (byte)(var2 ? 1 : 0));
   }

   private byte[] a(int var1, byte var2) {
      byte[] var3 = new byte[5];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, var3, 0, 2);
      var3[2] = 5;
      var3[4] = var2;
      return var3;
   }

   private byte[] a(int var1, int var2) {
      byte[] var3 = new byte[6];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, var3, 0, 2);
      var3[2] = 6;
      System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, var3, 4, 2);
      return var3;
   }

   private byte[] b(int var1, int var2) {
      byte[] var3 = new byte[8];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, var3, 0, 2);
      var3[2] = 8;
      System.arraycopy(com.aspose.cells.b.a.zc.a(var2), 0, var3, 4, 4);
      return var3;
   }

   private byte[] a(int var1, zakp var2, int var3, boolean var4, Workbook var5) {
      this.c = new byte[12];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, this.c, 0, 2);
      this.c[2] = 12;
      if (var4) {
         this.c[4] = 4;
         return this.c;
      } else {
         this.a(this.c, 4, var2, 64, var5);
         return this.c;
      }
   }

   private byte[] a(int var1, String var2) {
      byte[] var3 = new byte[6 + var2.length() * 2];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, var3, 0, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3.length), 0, var3, 2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var2.length()), 0, var3, 4, 2);
      byte[] var4 = Encoding.getUnicode().a(var2);
      System.arraycopy(var4, 0, var3, 6, var4.length);
      return var3;
   }

   private byte[] a(int var1, int var2, Border var3, Style var4, boolean var5, Workbook var6) {
      this.c = new byte[14];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1), 0, this.c, 0, 2);
      this.c[2] = 14;
      if (var5) {
         this.c[4] = 4;
      } else {
         this.a(this.c, 4, var3.a, 64, var6);
      }

      int var7 = zcee.n(var3.getLineStyle());
      System.arraycopy(com.aspose.cells.b.a.zc.a(var7), 0, this.c, 12, 2);
      return this.c;
   }

   void a(byte[] var1, int var2, zakp var3, int var4, Workbook var5) {
      if (var3.a()) {
         this.c[var2] = 1;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, this.c, var2 + 1, 2);
      } else {
         if (var3.b() == 2) {
            this.c[var2 + 0] = (byte)((this.a(var3.b()) & 255) << 1);
         } else {
            this.c[var2 + 0] = (byte)(((this.a(var3.b()) & 255) << 1) + 1);
         }

         this.c[var2 + 1] = (byte)var3.d();
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)((int)(var3.f() * 32767.0D))), 0, this.c, var2 + 2, 2);
         int var6 = var3.c(var5);
         this.c[var2 + 4] = (byte)((var6 & 16711680) >> 16);
         this.c[var2 + 5] = (byte)((var6 & '\uff00') >> 8);
         this.c[var2 + 6] = (byte)(var6 & 255);
         this.c[var2 + 7] = -1;
      }
   }

   byte a(int var1) {
      switch(var1) {
      case 0:
         return 0;
      case 1:
         return 4;
      case 2:
         return 2;
      case 3:
         return 1;
      case 4:
         return 3;
      default:
         return 4;
      }
   }
}
